package com.maila.xiaoaodispatch.adpter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.maila.xiaoaodispatch.R;
import com.maila.xiaoaodispatch.entity.OrderData;
import com.zhy.autolayout.AutoLinearLayout;
import com.zhy.autolayout.utils.AutoUtils;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by Administrator on 2017/11/2.
 */

public class OrderHallAdapter extends BaseAdapter {
    Context context;
    List<OrderData.DataBean> mdata;

    public OrderHallAdapter(Context context) {
        this.context = context;
        mdata=new ArrayList<>();

    }

    public List<OrderData.DataBean> getMdata() {
        return mdata;
    }

    public void setMdata(List<OrderData.DataBean> mdata) {
        this.mdata = mdata;
    }
    public void addMdata(List<OrderData.DataBean> mdata) {
        this.mdata.addAll(mdata);
    }
    @Override
    public int getCount() {
        return mdata.size();
    }

    @Override
    public Object getItem(int i) {
        return null;
    }

    @Override
    public long getItemId(int i) {
        return 0;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        ViewHolder holder = null;
        if (view == null) {
            view = LayoutInflater.from(context).inflate(R.layout.item_orderhall, viewGroup, false);
            holder = new ViewHolder(view);
            view.setTag(holder);
            AutoUtils.autoSize(view);
        } else {
            holder = (ViewHolder) view.getTag();
        }

        return view;
    }

    static class ViewHolder {
        @BindView(R.id.tv_send)
        TextView tvSend;
        @BindView(R.id.tv_get)
        TextView tvGet;
        @BindView(R.id.tv_express)
        TextView tvExpress;
        @BindView(R.id.tv_money)
        TextView tvMoney;
        @BindView(R.id.btn_connect_shop)
        AutoLinearLayout btnConnectShop;
        @BindView(R.id.btn_connect_clint)
        AutoLinearLayout btnConnectClint;
        @BindView(R.id.btn_take_order)
        TextView btnTakeOrder;

        ViewHolder(View view) {
            ButterKnife.bind(this, view);
        }
    }
}
